<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>质数</title>
	<script type="text/javascript">
		var num = +prompt("请输入一个整数：");

		var flag = true;

		for(var i=2;i<num;i++){
			if(num % i == 0){
				flag = false;
				break;
			}
		}

		if(flag){
			alert(num + "是质数！");
		}else{
			alert(num + "不是质数！");
		}
	</script>
</head>
<body>
</body>
</html>